﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Barbar.MapReport.Common.Drawing.Commands;
using Barbar.MapReport.Common.Drawing;
using System.Drawing;
using Barbar.MapReport.Common;
using Barbar.MapReport.HtmlRender;
using Barbar.MapReport.Configuration;

public partial class FixColorRegionExample : MapReportDemoPage {
  protected void Page_Load(object sender, EventArgs e) {
    AddRegionsWithFixColorCommand command = new AddRegionsWithFixColorCommand();

    ColoredRegionList regionList;
    
    regionList = new ColoredRegionList();
    regionList.FillColor = new SerializedColor(Color.FromArgb(128, Color.Red));
    regionList.StrokeColor = new SerializedColor(Color.Black);
    regionList.ToolTip = "I love Germany and Czech Republic, you clicked on {Name}";
    regionList.RegionIds.Add("DEU");
    regionList.RegionIds.Add("CZE");
    command.Regions.Add(regionList);


    regionList = new ColoredRegionList();
    regionList.FillColor = new SerializedColor(Color.FromArgb(128, Color.Blue));
    regionList.StrokeColor = new SerializedColor(Color.Black);
    regionList.ToolTip = "I love United Kingdom, you clicked on {Name}";
    regionList.RegionIds.Add("GBR");
    command.Regions.Add(regionList);

    RenderingService renderService = new RenderingService();
    renderService.Execute(command);

    RenderSettings settings = new RenderSettings(new SerializedUnit(800), new SerializedUnit(600), 55, 5, 5, MapConfigurationManager.MapSettings.GoogleKeyProvider.DefaultGoogleKey, 2057);
    settings.EnableGoogleBar = true;

    MapHtmlFragment fragment = renderService.Render(settings);
    litMapDiv.Text = fragment.MapElement;
  }
}
